import { useNavigate } from "react-router-dom";
import { useAppSelector } from "../app/hooks";

export const useClickWidthLogin = (callback: Function) => {
	const token = useAppSelector(state => state.user.token)
	const navigate = useNavigate()
	return () => {
		if (token) {
			callback()
		} else {
			navigate('/login')
		}
	}
}